import request from '@/utils/request'

export default {

  /**
   * 获取分页所有的宿舍
   * @param buildingParams 查询楼栋信息所需数据对象
   */
  getBuilding(buildingParams) {
    return request({
      url: '/building/getBuildingByPage',
      method: 'get',
      params: buildingParams
    })
  },

  /**
   * 删除楼栋
   * @param id 楼栋id
   */
  delBuilding(id) {
    return request({
      url: `/building/delBuildingById/${id}`,
      method: 'delete'
    })
  },

  /**
   * 修改楼栋信息
   * @param buildingInfo 楼栋信息
   */
  updBuilding(buildingInfo){
    return request({
      url:'/building/updateBuilding',
      method:'put',
      data:JSON.stringify(buildingInfo)
    })
  },

  /**
   * 添加楼栋
   * @param buildingInfo 楼栋信息
   */
  addBuilding(buildingInfo){
    return request({
      url:'/building/addBuilding',
      method:'post',
      data:JSON.stringify(buildingInfo)
    })
  },

  /**
   * 简单获取楼栋信息（id和name）
   */
  getAllSimpleBuilding(){
    return request({
      url:'/building/getAllBuilding',
      method:'get'
    })
  },

  /**
   * 通过性别获取楼栋
   * @param gender g性别
   */
  getBuildingByGender(gender){
    return request({
      url:`/building/getBuildingBygender/${gender}`,
      method:'get'
    })
  }

}
